		var documentId = getHref().documentId;      //合同号							
		$(".documentAdult").click(function(){
			parent.layer.open({
				type: 2,
				title: ['合同审核','background-color:#6d6e72; color:#fff;'],
				shadeClose: true,
				shade: 0.3,
				area: ['100%', '100%'],  
				content: ['../ak/documentAudit.html?documentId='+documentId],// iframe的url，no代表不显示滚动条
				end:function(){
					getAjax();
				}
					
			});
		})
		//_______________________________________________________________________________
		$(".query").click(function(){
			statusNew();
			getAjax();
		})
		getAjax()
		function getAjax(){	
		$.get("../contract/"+documentId,function(data){
				var data = JSON.parse(data);		
				documentStatus =  data.data.status;
				$(".status").text(commomFun.documentTypeStr(data.data.status))
				
				if(data.data.status=="1"){
					$(".documentAdult").show();
					$(".documentChange").hide();					
					var status ="";			
				}if(data.data.status=="2"){
					$(".documentAdult").hide();
					$(".documentChange").show();	
					var status ="通过";
				}if(data.data.status=="3"){
					$(".documentAdult").hide();
					$(".documentChange").hide();
					var status ="不通过";					
				}if(data.data.status=="4"){
					$(".documentAdult").hide();
					$(".documentChange").show();
					var status ="通过";					
				}if(data.data.status=="5"){
					$(".documentAdult").hide();
					$(".documentChange").hide();
					var status ="通过";					
				}if(data.data.status=="6"){
					$(".documentAdult").hide();
					$(".documentChange").hide();
					var status ="";
				}if(data.data.status=="7"){
					$(".documentAdult").hide();
					$(".documentChange").hide();
					var status ="";
				}
				
				
				$(".auditTime").text(data.data.auditTime)
				$(".auditPeople").text(data.data.auditorName)
				$(".auditResult").text(status)
				$(".auditMess").text(data.data.auditOpinion)
				$(".documentNo").text(data.data.id)
				$(".pfNo").text(data.data.platformContractId)
				$(".customer").text(data.data.customerName)								
				$(".money").val(data.data.deposit)
				$(".quoteCurrency").text(commomFun.currencyMStr(data.data.quoteCurrency));//报价货币类型
				$(".settleCurrency").text(commomFun.currencyMStr(data.data.settleCurrency));//实收货币类型
				$(".settleDeposit").text(commomFun.toEmptyString(data.data.settleDeposit));//报价货币金额
			})
		//_______________________________________________________________________________
			var startDate = $('.startDate').val();
			var endDate = $('.endDate').val();	
			var dayOfWeek = function(){                    //星期
				var length = $(".dayOfWeek input[type=checkbox]").length;
				var arr = [];
				for(var i=0;i<length;i++){
					if($(".dayOfWeek input[type=checkbox]")[i].checked){
						arr.push($(".dayOfWeek input[type=checkbox]").eq(i).val());
					}
				}
				return arr;
			}();
			$.get("../contract/"+documentId+"/order?startDate="+startDate+"&dayOfWeek="+dayOfWeek+"&endDate="+endDate+"&temp="+Math.random(),function(data){
				$(".clear").empty();
				var data = JSON.parse(data);
				$('.totalOrder').text(data.data.length)
				var strOrderMess = "";
				for(var i=0;i<data.data.length;i++){
					var itineraries = data.data[i].itineraries;
					var len = itineraries.length;
					var inputStr = "";
					var connectSignStr = "";
					var singleSignStr = "";
					if(data.data[i].status=='1'||data.data[i].status=='6'){
						inputStr+="<input class='docuChangeCheck check' type='checkbox' " +
									" orderId="+data.data[i].id+
									" passengerTotal="+data.data[i].passengerTotal+
									" ticketLoss="+data.data[i].ticketLoss+
									" ticketLossRate="+data.data[i].ticketLossRate+
									" ticketRate="+data.data[i].ticketRate+
									" price="+data.data[i].price+ 
									" viewAdultPrice="+data.data[i].viewAdultPrice+
									" childPrice="+data.data[i].childPrice+
									" viewChildPrice="+data.data[i].viewChildPrice+
									" infantPrice="+data.data[i].infantPrice+
									" viewInfantPrice="+data.data[i].viewInfantPrice+
								  ">";
					}
					if(data.data[i].connect=="1"){
						connectSignStr+="<label class='connectSign'></label>";
					}
					if(data.data[i].single=="2"){
						singleSignStr+="<label class='singleProductSign'>单边</label>";
					}
					strOrderMess += "<tr class='orderMessTr'>" +
									 "<td colspan=4>" +
									 	"<ul>" +								 		
									 		"<li>"+inputStr+"</li>" +									 		
									 		"<li>订单号: <span class='fontf9a000 orderId'>"+data.data[i].id+singleSignStr+"</span></li>" +
									 		"<li>"+connectSignStr+"</li>" +
									 		"<li><span class='iconfont edit'" +
										 		" orderId="+data.data[i].id+
												" passengerTotal="+data.data[i].passengerTotal+
												" ticketLoss="+data.data[i].ticketLoss+
												" ticketLossRate="+data.data[i].ticketLossRate+
												" ticketRate="+data.data[i].ticketRate+
												" price="+data.data[i].price+ 
												" viewAdultPrice="+data.data[i].viewAdultPrice+
												" childPrice="+data.data[i].childPrice+
												" viewChildPrice="+data.data[i].viewChildPrice+
												" infantPrice="+data.data[i].infantPrice+
												" viewInfantPrice="+data.data[i].viewInfantPrice+
									 		">&#xe681;</span></li>" +
									 	"</ul>" +									 	
									 "</td>" +
									 "<td colspan=4>" +
									 	"<span>状态: <b class='fontfe3e3d'>"+commomFun.orderTypeStr(data.data[i].status)+"</b></span>" +
									 	"<span>数量: <b>"+data.data[i].passengerTotal+"</b></span>" +
									 	"<span>出票率: <b>"+data.data[i].ticketRate+"</b></span>" +
									 	"<span>票损: <b>"+data.data[i].ticketLoss+"</b></span>" +
									 	"<span>票损率: <b>"+data.data[i].ticketLossRate+"</b></span>" +
									 "</td>" +									 									 																
								   "</tr>"
					for(var j=0;j<len;j++){	
						var tabledayOfWeek = (data.data[i].itineraries[j].dayOfWeek=="0")?"7":data.data[i].itineraries[j].dayOfWeek;
						strOrderMess += "<tr>" +
											"<td>"+itineraries[j].flightNumber+"</td>"+
											"<td>"+tabledayOfWeek+"</td>"+
											"<td>"+itineraries[j].departureAirport+"("+itineraries[j].departureAirportCode+")<span style='color:#00aa98;'>"+itineraries[j].departureAirportTerminal+"</span></br>"+itineraries[j].departureDate+"&nbsp;&nbsp;&nbsp;"+itineraries[j].departureTime+"</td>"+
											"<td>"+itineraries[j].arriveAirport+"("+itineraries[j].arriveAirportCode+")<span style='color:#00aa98;'>"+itineraries[j].arriveAirportTerminal+"</span></br>"+itineraries[j].arriveAirportDate+"&nbsp;&nbsp;&nbsp;"+itineraries[j].arriveAirportTime+"</td>"+					   
											"<td>"+commomFun.cabinStatusStr(data.data[i].itineraries[j].seatClass)+"</td>"
						if(j==0){
							strOrderMess += "<td rowspan="+len+"><span class='font00aa98'>"+data.data[i].price+"</span><span class='fontaaaaaa'>/</span>"+commomFun.toLine(data.data[i].viewAdultPrice)+"</td>"+
									        "<td rowspan="+len+"><span class='font00aa98'>"+data.data[i].childPrice+"</span><span class='fontaaaaaa'>/</span>"+commomFun.toLine(data.data[i].viewChildPrice)+"</td>"+										    "<td rowspan="+len+"><span class='font00aa98'>"+data.data[i].infantPrice+"</span><span class='fontaaaaaa'>/</span>"+commomFun.toLine(data.data[i].viewInfantPrice)+"</td>"
						}											
							strOrderMess +=	"</tr>";																	
					}
				}
				$(".clear").append(strOrderMess);
			})
		}
	//________________________________________________________________________________点击订单号跳转到订单详情页面
	$('.tableCon').delegate(".orderId","click",function(){	
		var id=$(this).text();//获取当前订单状态的id值	
		layer.open({
			type: 2,
			title: false,
			closeBtn: 0,
			shadeClose: true,
			shade: 0.3,
			area: ['100%', '100%'],  
			content: ['../ak/embedDiv.html?id='+id],// iframe的url，no代表不显示滚动条
			end:function(){
				
			}
				
		});
	 })
	//________________________________________________________________________________点击合同变更
		$(".documentChange").click(function(){
			var onOff = $(this).attr("onOff");
			if(onOff=="false"){
				$(".docuChangeCheck,.checkAll").show();
				$(".cut").show();	
				$(".edit").show();
				if(documentStatus=="2"){
					$(".money").attr("readonly",false);
					$(".money").addClass("changeDepositClass");
					$(".depositChangeSure").show();
				} 
				$(this).attr("onOff","true");
			}else{
				$(".docuChangeCheck,.checkAll").hide();
				$(".cut").hide();
				$(".depositChangeSure").hide();
				$(".edit").hide();
				$(".money").removeClass("changeDepositClass");
				$(this).attr("onOff","false");
			}
			
		})
//________________________________________________________________________修改押金的提交
		$(".depositChangeSure").click(function(){
			//对押金做校验
			var deposit = $(".money").val();
			if(deposit==""){
				layer.msg("押金不能为空",{icon: 2,time:1000})
				return false; 
			}else if(!/^\d+(\.\d+)?$/.test($(".money").val())){
				layer.msg("押金为纯数字",{icon: 2,time:1000})
				return false; 
			}else if(/^\d+(\.\d+)$/.test($(".money").val())&&($(".money").val().split(".")[1].length>2)){
				layer.msg("押金的小数精度不超过两位",{icon: 2,time:1000})
				return false; 
			}else if(/^\d+(\.\d+)$/.test($(".money").val())&&($(".money").val().split(".")[0].length>8)){
				layer.msg("押金的额度过大",{icon: 2,time:1000})
				return false; 
			}
			layer.confirm('确认修改押金？', {
				title:['温馨提示','background-color:#00aa98;color:#fff'],
				shade: 0.8,
			   	btn: ['确定','取消'] //按钮
			}, function(){				
				layer.msg('更改中...', {icon: 16,shade: 0.01});
				$.ajax({
					type:"get",
					url:"../contract/"+documentId+"/updDeposit?deposit="+deposit+"&temp="+Math.random(),
					dataType:"json",
					success:function(data){		
						if(data.status=="1001"){
							layer.msg('修改成功', {icon: 1},function(){
								location.reload();								
							});							
						}else{					
							layer.confirm(data.message, {
								title:['修改失败','background-color:#00aa98;color:#fff'],
								shade: 0.8,
							   	btn: ['确定'] //按钮
							}, function(){
								layer.closeAll('dialog');
								location.reload();	
							});
							
						}
						
					}			
				});	
				
			});	
		
		})
		
//________________________________________________________________________________减班	
		$(".cutClass").click(function(){
			var checkedOrder = $(".clear input[type=checkbox]:checked");
			if(checkedOrder.length==0){
				layer.msg("请选择订单",{icon:2})
				return false;
			}
			var orderIdArr = [];
			$.each(checkedOrder, function(index, item){     
				orderIdArr.push($(item).attr("orderId"));    
			});
			layer.confirm("确定减班？",{
				title:['温馨提示','background-color:#6d6e72; color:#fff;']
			},function(){
				layer.load();
				$.ajax({
					type:"post",
					url:"../contract/"+documentId+"/minus?temp="+Math.random(),
					contentType:'application/json;charset=utf-8',
					data:JSON.stringify(orderIdArr),
					async:true,
					success:function(data){
						layer.closeAll('loading');
						data = JSON.parse(data)
						if(data.status=="1001"){
							layer.msg('减班成功', {icon: 1,time:1000},function(){													
								getAjax();
								statusNew();
							});			
						}else{
							layer.alert('减班失败,'+data.message)
						}
					}
				});
			})
			return false;												
		})
	//________________________________________________________________________________单个更改订单
		$(".clear").delegate(".edit","click",function(){
			cutSeatOrderMessage = {};
			cutSeatOrderMessage.orderId = $(this).attr("orderId");
			cutSeatOrderMessage.passengerTotal = $(this).attr("passengerTotal");
			cutSeatOrderMessage.ticketLoss = $(this).attr("ticketLoss");
			cutSeatOrderMessage.ticketLossRate = $(this).attr("ticketLossRate");
			cutSeatOrderMessage.ticketRate = $(this).attr("ticketRate");
			cutSeatOrderMessage.price = $(this).attr("price");
			cutSeatOrderMessage.viewAdultPrice = $(this).attr("viewAdultPrice");
			cutSeatOrderMessage.childPrice = $(this).attr("childPrice");
			cutSeatOrderMessage.viewChildPrice = $(this).attr("viewChildPrice");
			cutSeatOrderMessage.infantPrice = $(this).attr("infantPrice");
			cutSeatOrderMessage.viewInfantPrice = $(this).attr("viewInfantPrice");
			
			layer.open({
				type: 2,
				title: ['更改订单','background-color:#6d6e72; color:#fff;'],
				shadeClose: true,
				shade: 0.3,
				area: ['450px', '72%'],  
				content: ['../ak/cutSeat.html?type=S'],// iframe的url，no代表不显示滚动条
				end:function(){
					getAjax();
					statusNew();
				}			
			});
		})
		
	//________________________________________________________________________________批量更改订单
			
		$(".cutSeat").click(function(){
			var checkedOrder = $(".clear input[type=checkbox]:checked");
			var idArr = [];
			if(checkedOrder.length==0){
				layer.msg("请选择订单",{icon:2})
				return false;
			}else{
				checkedOrder.each(function(index,item){
					var id = $(item).attr("orderId");
					idArr.push(id);
				})
			}
			
			layer.open({
				type: 2,
				title: ['更改订单','background-color:#6d6e72; color:#fff;'],
				shadeClose: true,
				shade: 0.3,
				area: ['450px', '72%'],  
				content: ['../ak/cutSeat.html?idArr='+idArr+'&type=M'],// iframe的url，no代表不显示滚动条
				end:function(){
					getAjax();
					statusNew();
				}			
			});
		})
		//页面进行减班减位之后的状态
		function statusNew(){
			$(".documentChange").attr("onOff","false");
			$(".cut").hide();
			$(".checkAll").hide().attr("checked",false);
			$(".edit").hide();
		}